extends Control

@onready var player = get_tree().get_first_node_in_group("Player")
@onready var battle_ground_ui = get_tree().get_first_node_in_group("BattleGroundUI")
#MySpriteData.SelectedDokiMons[%BattleGroundUI.selected]["Health"]
func _ready():
	await get_tree().create_timer(1).timeout
	%PlayerHPBar.max_value = player.get_child(0).Health
	%PlayerHPBar.value = player.get_child(0).Health
	
func _process(_delta):
	%PlayerHPBar.value = player.get_child(battle_ground_ui.selected).Health
	%PlayerHPTxt.text = str(player.get_child(battle_ground_ui.selected).Health) + "/" + str(player.get_child(battle_ground_ui.selected).MaxHealth) 
	if player.get_child(battle_ground_ui.selected).Health <= 0:
		%PlayerHPTxt.text = "0/" + str(player.get_child(battle_ground_ui.selected).MaxHealth) 
	%PlayerInfo.text = str(player.get_child(battle_ground_ui.selected).name) + " LV." + str(player.get_child(battle_ground_ui.selected).Level)
	
